package com.athbsd.Map;

import com.athbsd.exer4.Student;
import org.junit.Test;

import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import java.util.Objects;

/**
 * Date:2025/2/24
 * Author：zhouzhou
 * Description:
 */
public class MapTest {
    @Test
    public void test() {
//          错误
//        Map map2 = new Hashtable();
//        map2.put(null,123);
//        map2.put(123,null);
        Map map = new HashMap();
        map.put(null,null);
        System.out.println();
    }
    @Test
    public void test2() {
        HashMap map = new HashMap();
        map.put("aa",21);
        map.put("bb",33);
        map.put("cc",44);
        map.put("as",55);
        map.put(new Student("tom",90),12);
        System.out.println(map);
        System.out.println(map.size());
        //移除,返回object(value)
        Object value = map.remove("aa");
        System.out.println(value);
        //修改
        map.put("bb",99);
        System.out.println();
    }
}
